package com.godyao.mall.wms.controller;

import java.util.Arrays;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.godyao.mall.wms.entity.UndoLogEntity;
import com.godyao.mall.wms.service.UndoLogService;
import com.godyao.mall.core.utils.PageUtils;
import com.godyao.mall.core.model.ResultMsg;



/**
 * 
 *
 * @author godyao
 * @email godyao0801@qq.com
 * @date 2022-04-19 15:27:14
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("wms/undolog")
public class UndoLogController {
    
    private final UndoLogService undoLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public ResultMsg list(@RequestParam Map<String, Object> params){
        PageUtils page = undoLogService.queryPage(params);

        return ResultMsg.resultSuccess(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public ResultMsg info(@PathVariable("id") Long id){
		UndoLogEntity undoLog = undoLogService.getById(id);

        return ResultMsg.resultSuccess(undoLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public ResultMsg save(@RequestBody UndoLogEntity undoLog){
		undoLogService.save(undoLog);

        return ResultMsg.resultSuccess("OK");
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public ResultMsg update(@RequestBody UndoLogEntity undoLog){
		undoLogService.updateById(undoLog);

        return ResultMsg.resultSuccess("OK");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public ResultMsg delete(@RequestBody Long[] ids){
		undoLogService.removeByIds(Arrays.asList(ids));

        return ResultMsg.resultSuccess("OK");
    }

}
